package dz.home.zk7;

import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Button;
import org.zkoss.zul.Grid;
import org.zkoss.zul.Label;
import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Row;
import org.zkoss.zul.Rows;
import org.zkoss.zul.Window;

public class GenerateComp extends Window implements EventListener<Event>{

	private static final long serialVersionUID = 1L;
	Rows rs = new Rows();
	Row l1 = new Row();
	Button button =null;
	Grid gr= new Grid();
	Label lab = new Label("Cliquer pour afficher le message : Salut tous");

	public GenerateComp() {
		button = new Button("Envoyer");
		button.addEventListener(Events.ON_CLICK, this);
		rs.appendChild(l1);
		l1.appendChild(button);
		gr.appendChild(rs);
		this.setWidth("35%");
		this.setHeight("40%");
		this.setBorder("normale");
		this.setMode("overlapped");
		this.setPosition("center");
		this.appendChild(gr);
		this.appendChild(lab);
		this.setTitle("Java window");
	}

	public void onEvent(Event e) throws Exception {
		Messagebox.show(lab.getValue().substring(lab.getValue().indexOf(":")+1, lab.getValue().length()));
	}

}